package com.atguigu.executorpool;

import pojo.Person;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @program: IDEAcode
 * @description:
 * @author: Mr.zjx
 * create: 2021-07-31-21-44
 **/
public class myArrayList {
    public static void main(String[] args) {
        //创建集合类型，存储自定义Person类型
        List<Person> list = new ArrayList<Person>();
        list.add(new Person("张三",2));
        list.add(new Person("张五",3));
        list.add(new Person("张六",4));
        list.add(new Person("张七",5));
        //迭代器遍历
        Iterator<Person> it = list.iterator();
        while (it.hasNext()){
            Person next = it.next();
            System.out.println(next);
        }
    }
}
